<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/9/25 10:14
 * Modified Time: 2019/9/25 10:14
 * Version: 2.0
 */

namespace App\Modules\DataCenter\Controllers;


use App\Modules\DataCenter\Services\EmployeeAchievementService;
use Flower\Core\Http\BaseController;
use Illuminate\Http\Request;

class EmployeeAchievementController extends BaseController
{
    protected $employeeAchievementService;

    public function __construct(EmployeeAchievementService $employeeAchievementService)
    {
        $this->employeeAchievementService = $employeeAchievementService;
    }

    /**
     * 数据中心头部信息
     * @param Request $request
     * @return mixed
     */
    public function getEmployeeAchievementHeader(Request $request)
    {
        $store_id = $request->input('store_id');
        $user_id = $request->input('user_id');
        $date_type = $request->input('date_type', 0);
        $data = $this->employeeAchievementService->getEmployeeAchievementHeader($store_id, $user_id, $date_type);
        return $this->display($data, 'ok');
    }

    public function getEmployeeAchievementServiceRate(Request $request)
    {
        $store_id = $request->input('store_id');
        $user_id = $request->input('user_id');
        $date_type = $request->input('date_type', 0);
        $data = $this->employeeAchievementService->getEmployeeAchievementServiceRate($store_id, $user_id, $date_type);

        return $this->display($data, 'ok');
    }

    public function getEmployeeAchievementRoyalty(Request $request)
    {
        $store_id = $request->input('store_id');
        $user_id = $request->input('user_id');
        $date_type = $request->input('date_type', 0);

        $data = $this->employeeAchievementService->getEmployeeAchievementRoyalty($store_id, $user_id, $date_type);

        return $this->display($data, 'ok');
    }
}